package framework.server.cfg;

import java.util.List;

public class ServiceCfg {

	private String name;
	private String className;
	private String path;
	private String jar;
	private boolean runnig;
	private List<ParamCfg> params;

	public ServiceCfg(String name, String className, String path, String jar, boolean runnig) {
		this.name = name;
		this.className = className;
		this.path = path;
		this.jar = jar;
		this.runnig = runnig;
	}

	public String getName() {
		return name;
	}

	public String getClassName() {
		return className;
	}

	public String getPath() {
		return path;
	}

	public String getJar() {
		return jar;
	}

	public boolean isRunnig() {
		return runnig;
	}

	public List<ParamCfg> getParams() {
		return params;
	}

	public void setParams(List<ParamCfg> params) {
		this.params = params;
	}

	public void addParam(ParamCfg paramCfg) {
		params.add(paramCfg);
	}

	public String toString() {
		return "ServiceCfg [name: " + name + ", class: " + className + "]"; 
	}

	public ParamCfg getParam(String paramName) {
		for(ParamCfg param: params) {
			if (param.getName().equalsIgnoreCase(paramName)) {
				return param;
			}
		}
		return null;
	}
}
